package com.example.dangerouscargodriver.ui.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.example.dangerouscargodriver.R;
import com.example.dangerouscargodriver.utils.AppManager;
import com.example.dangerouscargodriver.widget.ActionBar;

public class CompanyAddTruckSuccessActivity extends AppCompatActivity implements View.OnClickListener {

	private ActionBar mActionBar = null;
	private TextView mReturnHome = null;
	private TextView mViewDetailInfo = null;
	private String mTid = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_company_add_truck_success);
		mTid = getIntent().getStringExtra("tid");

		mReturnHome = findViewById(R.id.tv_action_return_home);
		mReturnHome.setOnClickListener(this);

		mViewDetailInfo = findViewById(R.id.tv_action_see_detail);
		mViewDetailInfo.setOnClickListener(this);

		mActionBar = findViewById(R.id.actionBarCompanyAddTruckSuccess);
		mActionBar.setOnBackClickListener( new View.OnClickListener(){

			@Override
			public void onClick(View v) {
				AppManager.getAppManager().finishActivity();
				AppManager.getAppManager().finishActivity();
				finish();
			}
		});
	}

	@Override
	public void onClick(View v) {
		if(v.getId() == R.id.tv_action_return_home){
			AppManager.getAppManager().finishActivity();
			AppManager.getAppManager().finishActivity();
			finish();
			/*
			Intent intent=new Intent();
			intent.setAction(MainActivity.ACTION_SWITCH_FRAGMENT);
			intent.putExtra("Goal",0);
			sendBroadcast(intent);
			 */
		}
		else if(v.getId() == R.id.tv_action_see_detail){
			AppManager.getAppManager().finishActivity();
			finish();
			Intent intent = new Intent(this, CompanyTruckDetailInfoActivity.class);
			intent.putExtra("tid", mTid);
			startActivity(intent);
		}
		else{

		}
	}
}